package com.example.chongwushangcheng.model;

import java.util.ArrayList;
import java.util.List;

/**
 * 评论模型类
 */
public class Comment {
    private int id;
    private int avatarResId;
    private String username;
    private String content;
    private String time;
    private boolean isAuthor;
    private List<Reply> replies;

    public Comment(int id, int avatarResId, String username, String content, String time, boolean isAuthor) {
        this.id = id;
        this.avatarResId = avatarResId;
        this.username = username;
        this.content = content;
        this.time = time;
        this.isAuthor = isAuthor;
        this.replies = new ArrayList<>();
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getAvatarResId() {
        return avatarResId;
    }

    public void setAvatarResId(int avatarResId) {
        this.avatarResId = avatarResId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public boolean isAuthor() {
        return isAuthor;
    }

    public void setAuthor(boolean author) {
        isAuthor = author;
    }

    public List<Reply> getReplies() {
        return replies;
    }

    public void setReplies(List<Reply> replies) {
        this.replies = replies;
    }

    public void addReply(Reply reply) {
        if (this.replies == null) {
            this.replies = new ArrayList<>();
        }
        this.replies.add(reply);
    }
} 